package com.hpjz.emrecord.web.controller;

import java.util.Map;

import javax.annotation.Resource;

import lombok.extern.log4j.Log4j;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hpjz.common.ParameterBean;
import com.hpjz.common.ResultBean;
import com.hpjz.common.utils.ConstantDefinition;
import com.hpjz.emrecord.service.IGpsInfoService;
import com.hpjz.emrecord.web.vo.GpsInfoVO;
import com.hpjz.emrecord.web.vo.PatientInfoVO;

@Controller
@RequestMapping("/gpsInfo")
@Log4j
public class GpsInfoController {
	
	@Resource
	private IGpsInfoService gpsInfoService;
	
	@RequestMapping(value = "/insertGpsInfo",method = RequestMethod.POST)
	public @ResponseBody ResultBean insertGpsInfo(@RequestBody ParameterBean pb){
		
		GpsInfoVO objMap = (GpsInfoVO) pb.getParameter(GpsInfoVO.class);
		ResultBean result = new ResultBean();
		 try {
			 this.gpsInfoService.insertGpsInfo(objMap);
			 result.setStatus(ConstantDefinition.SYSTEM_SUCCESS);
		} catch (Exception e) {
			 log.error("添加车俩位置信息失败！",e);
			 result.setStatus(ConstantDefinition.SYSTEM_ERROR);
		}
		 return result;
	}
	
	
	
	 /**
	  * 查询车辆坐标信息
	  * @param pb
	  * @return
	  */
	@RequestMapping(value = "/findCarPosition",method = RequestMethod.POST)
	public @ResponseBody ResultBean findCarPosition(@RequestBody ParameterBean pb){
		
		GpsInfoVO objMap = (GpsInfoVO) pb.getParameter(GpsInfoVO.class);
		ResultBean result = new ResultBean();
		 try {
			 GpsInfoVO vo =  this.gpsInfoService.findCarPosition(objMap);
			 result.setResult(vo);
			 result.setStatus(ConstantDefinition.SYSTEM_SUCCESS);
		} catch (Exception e) {
			 log.error("获取车辆位置失败！",e);
			 result.setStatus(ConstantDefinition.SYSTEM_ERROR);
		}
		 return result;
	}
	

}
